<!DOCTYPE HTML>
<body>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<script>
description("window.closed should return true after window.close().");

window.jsTestIsAsync = true;

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.setPopupBlockingEnabled(false);
}
var w;
function processMessage(event) {
    if (event.data == "opened") {
        w.close();
        shouldBeTrue("w.closed");
    } else if (event.data == "closed") {
        shouldBeTrue("w.closed");
        finishJSTest();
    }
}

w = window.open('../../../resources/window-postmessage-open-close.html');
window.addEventListener("message", processMessage, false);
</script>
</body>
